home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue45 / Alfresco / AALZBase.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-11-02  |  1.8 KB  |  47 lines

  1. {*********************************************************}
  2. {* AALZBase                                              *}
  3. {* Copyright (c) Julian M Bucknall 1998-1999             *}
  4. {* All rights reserved.                                  *}
  5. {*********************************************************}
  6. {* Algorithms Alfresco LZ77 unit - Base Unit             *}
  7. {*********************************************************}
  8.  
  9. {Note: this unit is released as freeware. In other words, you are free
  10.        to use this unit in your own applications, however I retain all
  11.        copyright to the code. JMB}
  12.  
  13. unit AALZBase;
  14.  
  15. interface
  16.  
  17. uses
  18.   SysUtils;
  19.  
  20. type
  21.   TaaLZKey = packed record {a 3-character signature string}
  22.     case boolean of
  23.       false : (AsLong   : longint);
  24.       true  : (AsString : string[3]);
  25.   end;
  26.  
  27.  
  28. {Notes: the following constants define the range of values for the
  29.         distance and length encodings. Generally the distance shift
  30.         value is 3, making the size of the sliding window 8192 bytes
  31.         and the maximum length to match 10 bytes. You can experiment
  32.         by setting the shift value to 4 (sliding window is 4096 bytes,
  33.         max length is 18 bytes) or even 2 (window is 16384 bytes, max
  34.         length is 6 bytes). The bigger the sliding window, the slower
  35.         the compression is since there's more to compare to get the
  36.         longest match}
  37. const
  38.   aalzDistanceShift = 4;                                     {..3}
  39.   aalzLengthMask = (1 shl aalzDistanceShift) - 1;            {..$7}
  40.   aalzSlidingWindowSize = (1 shl (16 - aalzDistanceShift));  {..8192}
  41.   aalzMaxMatchLength = aalzLengthMask + 3;                   {..10}
  42.   aalzLookAheadSize = aalzMaxMatchLength;                    {..10}
  43.  
  44. implementation
  45.  
  46. end.
  47.